package com.py.credit.dao;

import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * @Company: WWW.xypy.com.cn
 * @ClassName UserReportDao
 * @Description: 用户前台申报dao层
 * @Author: YaoS
 * @Create: 2018-10-22 15:37
 **/
public interface UserReportDao {
    /**
     * 查询表的id
     */
    String selectCubeTable(@Param(value = "rootId") String rootId);

    /**
     * 添加元数据
     */
    void addProcess(@Param(value = "id") String id,
                    @Param(value = "tableId") String tableId,
                    @Param(value = "tablename") String tablename,
                    @Param(value = "resource") String resource,
                    @Param(value = "mainName") String mainName,
                    @Param(value = "cjr") String cjr,
                    @Param(value = "zxcz") String zxcz,
                    @Param(value = "mainType") String mainType,
                    @Param(value = "dataId") String dataId,
                    @Param(value = "recordId") String recordId
    );

    /**
     * 添加详情数据
     */
    void addDetail(@Param(value = "id") String id,
                   @Param(value = "newValue") String newValue,
                   @Param(value = "tablename") String tablename,
                   @Param(value = "fieldname") String fieldname,
                   @Param(value = "cjr") String cjr,
                   @Param(value = "process_id") String process_id,
                   @Param(value = "metricCode") String metricCode,
                   @Param(value = "oldValue") String oldValue);


    void addListDetail(@Param(value = "id") String id,
                       @Param(value = "list") List list,
                       @Param(value = "tablename") String tablename,
                       @Param(value = "cjr") String cjr,
                       @Param(value = "process_id") String process_id);

    /**
     * 查询当前待审核的record表
     *
     * @param tybm
     * @return List
     * @author YaoS
     * @date 14:11 18/10/30
     **/
    List<Map<String, Object>> selectRecordList(
            @Param(value = "tybm") String tybm,
            @Param(value = "tableId") String tableId
    );

    List<Map<String, Object>> selectCommitRecordList(
            @Param(value = "tybm") String tybm,
            @Param(value = "tableId") String tableId
    );

    void updateRecordList(
            @Param(value = "isAuditing") String isAuditing,
            @Param(value = "tybm") String tybm,
            @Param(value = "tableId") String tableId
    );

    /**
     * 保存数据到record表
     *
     * @param
     * @return
     * @author YaoS
     * @date 19:26 18/10/30
     **/
    void insertRecordTable(
            @Param(value = "id") String id,
            @Param(value = "tableName") String tableName,
            @Param(value = "tableId") String tableId,
            @Param(value = "tybm") String tybm,
            @Param(value = "type") String type,
            @Param(value = "dataId") String dataId,
            @Param(value = "chinaName") String chinaName
    );

    /**
     * 更新recordDetail详情表
     *
     * @param keyName
     * @param valueName
     * @param recordId
     * @return
     * @author YaoS
     * @date 10:06 18/10/31
     **/
    void updateRecordDetail(
            @Param(value = "keyName") String keyName,
            @Param(value = "valueName") String valueName,
            @Param(value = "recordId") String recordId
    );

    /**
     * 保存数据到recordDetail表
     *
     * @param recordId
     * @param keyName
     * @param valueName
     * @return
     * @author YaoS
     * @date 20:53 18/10/30
     **/
    void insertRecordDetail(
            @Param(value = "keyName") String keyName,
            @Param(value = "valueName") String valueName,
            @Param(value = "recordId") String recordId,
            @Param(value = "codeName") String codeName
    );

    /**
     * 查询当前企业的record详情数据信息
     *
     * @param id
     * @return
     * @author YaoS
     * @date 10:01 18/10/31
     **/
    List<Map<String, Object>> selectRecordDetail(
            @Param(value = "id") String id
    );

    /**
     * 更新record状态
     *
     * @param id
     * @param type
     * @return void
     * @author YaoS
     * @date 10:13 18/10/31
     **/
    void updateRecordByStatus(
            @Param(value = "id") String id,
            @Param(value = "type") String type
    );

    /**
     * 删除记录
     *
     * @param id
     */
    void delRecord(
            @Param(value = "id") String id
    );

    /**
     * 删除记录详情
     *
     * @param recordId
     */
    void delRecordDetail(
            @Param(value = "recordId") String recordId
    );

    /**
     * 查看表数据是否在审核中
     *
     * @param tybm
     * @param resourceId
     * @return
     */
    int checkTableAudit(
            @Param(value = "tybm") String tybm,
            @Param(value = "resourceId") String resourceId
    );
}

